# -*- coding: utf-8 -*-

import os
import time
import datetime


def read_file(path, text):
    with open(file=path, mode='r') as file:
        file.re
        pass


def write_aline(path, line):
    # 判断文件路径是否存在，不存在就创建
    if not os.path.exists(path):
        dirs = path[:path.rfind(os.sep)]
        if not os.path.exists(dirs):
            os.makedirs(dirs)
            pass
        pass
    # 以追加模式按行将文本写入文件
    with open(name=path, mode='a+') as file:
        file.write(line + "\n")
        pass


if __name__ == '__main__':
    path = "/Users/hn/Desktop/1/1/1/1/vim.txt"

    write_aline("logs/1.log", datetime.datetime.now().strftime("%Y-%m-%d"))
    os.remove("logs/1.log")


    pass
